import Vue from 'vue'
import Vuex from 'vuex'
import user from './modules/user'
import token from './modules/token'
import msg from './modules/msg'
import vote from './modules/vote'
import result from './modules/result'
import {
  TOGGLE_DRAWER
} from './mutation-types'

import vuexRouterInterceptor from '../plugin/vuex-router-interceptor'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    drawerVisibility: false
  },
  mutations: {
    [TOGGLE_DRAWER](state) {
      state.drawerVisibility = !state.drawerVisibility;
    }
  },
  modules: {
    user,
    token,
    msg,
    vote,
    result
  },
  plugins: [vuexRouterInterceptor()],
  strict: process.env.NODE_ENV !== 'production'
})
